﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using COM.OA.Entity;
using COM.OA.BLL;

public partial class wc_rlzy_aaaa : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
         users loginuser =Session["loginuser"] as COM.OA.Entity.users;
         if (loginuser == null)
         {
             this.Response.Write(string.Format(GetRedirect.ALLREDIRECT, "../login.aspx"));
         }
         else
         {
             //通过登录人ID查询  
             //1 已经有 今天考勤不能继续添加 否则 可添加
             int id = loginuser.u_id;
             string where = "att_u_id=" + id;
             IList<attendance> ilist = attendanceBLL.Select(where);
             if (ilist.Count == 0)//没数据 跳转传2
             {
                 this.Response.Write(string.Format(GetRedirect.REDIRECT, "rlzy_zxkq.aspx?at=2"));
             }
             else
             {
                 List<attendance> list = (List<attendance>)ilist;
                 attendance at = new attendance();
                 at = list[0];
                 string time = DateTime.Now.ToString("yyyy-MM-dd");
                 string t = at.att_date.ToString("yyyy-MM-dd");
                 if (time.Equals(t))//如果最后一条记录日期与今天相同 跳转传1
                 {
                     this.Response.Write(string.Format(GetRedirect.REDIRECT, "rlzy_zxkq.aspx?at=1"));

                 }
                 else//如果最后一条记录日期与今天不相同 跳转传2
                 {
                     this.Response.Write(string.Format(GetRedirect.REDIRECT, "rlzy_zxkq.aspx?at=2"));

                 }
             }
         }

    }
}
